//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<CCanvasText.h>
///	@path	~/src/graphics/canvas/
///	@date	2007/12/05
///	@desc	Static text on canvas.

#pragma once

#include "xeres.h"

#include "lib/math/color.h"
#include "lib/math/rect.h"

#include "object/IVar.h"

#include "graphics/IFont.h"
#include "graphics/ICanvasElement.h"

namespace xeres {

	/*!
		\class	CCanvasText
		\brief	Static text on canvas.
	*/
	class CCanvasText : public ICanvasElement
	{
	public:

		/// \ctor
		CCanvasText( RefWeak<IVar> var , RefWeak<IFont> font , int style , const Color4& color );

		/// \dtor
		virtual ~CCanvasText( void );

		DECL_IOBJECT_CLASS( CCanvasText , ICanvasElement );

	public:

	//@ interface

		/*!
			\brief		Render Canvas element.
		*/
		virtual void Render( RenderContext& rc , RefWeak<ISprite> sprite );

	//@ local

		/*!
			\brief
		*/
		void SetRect( const Rect<int>& rect );

		/*!
			\brief
		*/
		void SetStyle( int style );

		/*!
			\brief		
		*/
		void SetColor( const Color4& color );

	private:

	//@ data

		Ref<IVar>		m_text;
		Ref<IFont>		m_font;
		int				m_style;
		Rect<int>		m_rect;
		PackColor4		m_color;
	};

} // namespace xeres
